-- Autocmds are automatically loaded on the VeryLazy event
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
-- Add any additional autocmds here
-- local function augroup(name)
--   return vim.api.nvim_create_augroup("lazyvim_" .. name, { clear = true })
-- end
--
-- -- 关闭markdown的拼写检查
-- vim.api.nvim_create_autocmd("FileType", {
--   group = augroup("wrap_spell"),
--   pattern = { "gitcommit", "markdown" },
--   callback = function()
--     vim.opt_local.warp = true
--     vim.opt_local.spell = false
--   end,
-- })

vim.api.nvim_create_autocmd("BufEnter", {
  callback = function()
    if vim.bo.filetype ~= "lazyterm" then
      vim.api.nvim_set_current_dir(vim.fn.expand("%:p:h"))
    end
  end,
})

vim.api.nvim_create_autocmd("BufEnter", {
  pattern = { "*.fish", "*.json" },
  callback = function()
    vim.bo.shiftwidth = 4
  end,
})
